package br.com.mmm.javacenter.framework.view.taglib.tags;

import java.io.IOException;

import javax.servlet.jsp.JspException;

import br.com.mmm.javacenter.framework.view.taglib.helper.Input;

public class InputTag extends JavaCenterSimpleTagSupport{
	protected String name;
	protected String id;
	protected Object value;
	protected String label;
	protected boolean somenteLeitura;
	protected boolean inicioLinha;
	protected boolean finalLinha;
	protected int maxLength;
	
	public void doTag() throws JspException, IOException {
		Input input = new Input(getJspContext(), getJspBody());
		loadInputAttributes(input);
		input.make();
	}

	protected void loadInputAttributes(Input input) {
		input.setId(id);
		input.setName(name);
		input.setValue(value);
		input.setLabel(label);
		input.setSomenteLeitura(somenteLeitura);
		input.setInicioLinha(inicioLinha);
		input.setFinalLinha(finalLinha);
		input.setMaxLength(maxLength);
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Object getValue() {
		return value;
	}

	public void setValue(Object value) {
		this.value = value;
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public boolean isSomenteLeitura() {
		return somenteLeitura;
	}

	public void setSomenteLeitura(boolean somenteLeitura) {
		this.somenteLeitura = somenteLeitura;
	}

	public boolean isInicioLinha() {
		return inicioLinha;
	}

	public void setInicioLinha(boolean inicioLinha) {
		this.inicioLinha = inicioLinha;
	}

	public boolean isFinalLinha() {
		return finalLinha;
	}

	public void setFinalLinha(boolean finalLinha) {
		this.finalLinha = finalLinha;
	}

	public int getMaxLength() {
		return maxLength;
	}

	public void setMaxLength(int maxLength) {
		this.maxLength = maxLength;
	}
	
}
